package com.example.util;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class JavaToJsUtil {

	public static String escape(String str) throws ScriptException {

		ScriptEngineManager sem = new ScriptEngineManager();
		ScriptEngine engine = sem.getEngineByExtension("js");
		Object res = engine.eval("escape('" + str + "')");

		return res.toString();
	}

}
